package com.tanhua.server.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description: test
 * @Create by: JJ菜菜
 * @Date: 2021/11/29 22:45
 *
 *  将拦截器注册到MVC容器中
 */

@Configuration
public class WebConfig implements WebMvcConfigurer {


    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(new TokenInterceptor())
                .addPathPatterns("/**")         // 要拦截的路径
                .excludePathPatterns("/user/login", "/user/loginVerification");  // 要放行的路径
    }
}
